<div class="page-header">
  <h3>添加用户信息</h3>
</div>
<%= form_tag admins_accounts_path, method: :post, class: "form-horizontal create_user_info" do %>
  <div class="form-group">
    <label for="" class="col-sm-2 control-label">用户名</label>
    <div class="col-sm-10">
      <input type='text' name="user[login]"  value="<%=@user.login %>" />
    </div>
  </div>
  <div class="form-group">
    <label for="" class="col-sm-2 control-label">姓名</label>
    <div class="col-sm-10">      
      <input type='text' name="user[name]"  value="<%=@user.name %>" /> 
    </div>
  </div>
  <div class="form-group">
    <label for="" class="col-sm-2 control-label">邮箱</label>
    <div class="col-sm-10">
      <input type='text' name='user[email]' value="<%=@user.email %>" />
    </div>
  </div>

  <div class="form-group">
    <label for="" class="col-sm-2 control-label">密码</label>
    <div class="col-sm-10">
      <input type='password' name='user[password]' />
    </div>
  </div>

  <div class="form-group">
    <label for="" class="col-sm-2 control-label">确认密码</label>
    <div class="col-sm-10">
      <input type='password' name='user[password_confirmation]' />
    </div>
  </div>

  <div class="form-group">
    <label for="" class="col-sm-2 control-label">部门</label>
    <div class="col-sm-10">
      <select name='user[department_id]'>
        <% Department.all.each do |dep| %>
        <option value="<%=dep.id %>"  <%= "selected" if dep==@user.department %>><%=dep.name %></option>
        <% end %>
      </select>
    </div>
  </div>

  <div class="form-group">
    <label for="" class="col-sm-2 control-label">办公电话</label>
    <div class="col-sm-10">
      <input type='text' name='user[office_phone]' value="<%=@user.office_phone %>" />
    </div>
  </div>

  <div class="form-group">
    <label for="" class="col-sm-2 control-label">手机号码</label>
    <div class="col-sm-10">      
      <input type='text' name='user[mobile]' value="<%=@user.mobile %>" />
    </div>
  </div>

  <div class="form-group">
    <label for="" class="col-sm-2 control-label">角色</label>
    <div class="col-sm-10">      
      <% Group.all.each do |group| %>
        <input type='checkbox' value="<%=group.id %>" class='group_name' name='user[group][]' /><%=group.name %>
      <% end %>
    </div>
  </div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default btn-primary">创建</button>
    </div>
  </div>
<% end %>